<!DOCTYPE html>
<script>
var ex = false;
var doc;
var count = 0;

if (window.testRunner)
    testRunner.waitUntilDone();

function start() {
    if (location.hash == "") {
        location.hash = "#0";
    } else {
        count = parseInt(location.hash.substring(1));
        if (count >= 5) {
            document.write('PASS');
            if (window.testRunner) {
                testRunner.dumpAsText();
                testRunner.notifyDone();
            }
            return;
        }
    }

    doc = document.documentElement;
    mq1 = document.createElement('marquee');
    var iframe = document.createElement('iframe');
    iframe.src = "nonexistent";

    doc.appendChild(iframe);
    mq2 = mq1.cloneNode(false);

    iframe.onload = iframe_onload;
    setTimeout('start_pause1()', 100);
}

function start_pause1() {
    document.removeChild(doc);
    document.appendChild(doc);
    setTimeout('start_pause2()', 100);
}

function start_pause2() {
    document.removeChild(doc);
    gc();
    document.appendChild(doc);
    location.hash = '#' + ++count;
    location.reload();
}

function iframe_onload() {
    if (ex)
        return;
    ex = true;

    var iframe = document.createElement('iframe');
    iframe.src='resources/marquee-crash.svg';
    doc.appendChild(iframe);
}
</script>
<body onload="start()"></body>
